/**
 * 
 */
package com.vit.mep.model;

import java.util.Vector;

/**
 * @author crodriguez
 *
 */
public class TransactionData {
	
	private String dui;
	private String email;
	private String cardData;	
	private String transactionType;
	private String monto;
	
	public String getMonto() {
		return monto;
	}
	public void setMonto(String monto) {
		this.monto = monto;
	}
	private String cardNumber;
	private String expDate;
	private String result;
	private String nombre;
	private String cvv;
	
	
	
	public void parseCardData(){
		char sep = '^';
		Vector v = new Vector();		
		char[] charArray = cardData.toCharArray();
		int len = charArray.length;
		String temp="";
		for(int i=0; i<len; i++){			
			if(charArray[i] == sep){
				v.addElement(temp);
				temp= "";
			}else{
				temp+=charArray[i];
			}			
		}//for
		v.addElement(temp);
		temp = (String)v.elementAt(0);
		cardNumber = temp.substring(1);
		nombre = (String)v.elementAt(1);
		temp = (String)v.elementAt(2);
		expDate = temp.substring(0, 4);
		
		int qindex  = temp.indexOf('?');			
		cvv = temp.substring(qindex-9, qindex-6);
	}//parseCardData
	
	
	
	
	public String getCardNumberLbl(){
		if(this.cardNumber != null){
			return cardNumber.substring(cardNumber.length()-4, cardNumber.length());			
		}
		return "";
	}
	
	public String getCvvLbl(){
		if(this.cvv!= null){
			return cvv;
		}
		return "";
	}
	
	
	public String getCardNumber() {
		return cardNumber;
	}
	public void setCardNumber(String cardNumber) {
		this.cardNumber = cardNumber;
	}
	public String getExpDate() {
		return expDate;
	}
	public void setExpDate(String expDate) {
		this.expDate = expDate;
	}
	public String getResult() {
		return result;
	}
	public void setResult(String result) {
		this.result = result;
	}
	public String getNombre() {
		return nombre;
	}
	public void setNombre(String nombre) {
		this.nombre = nombre;
	}
	public String getTransactionType() {
		return transactionType;
	}
	public void setTransactionType(String transactionType) {
		this.transactionType = transactionType;
	}
	public String getDui() {
		return dui;
	}
	public void setDui(String dui) {
		this.dui = dui;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getCardData() {
		return cardData;
	}
	public void setCardData(String cardData) {
		this.cardData = cardData;
	}
	public String getCvv() {
		return cvv;
	}
	public void setCvv(String cvv) {
		this.cvv = cvv;
	}
	

}//class
